package dao;

import org.apache.ibatis.annotations.*;
import pojo.User;

import java.util.List;

public interface UserMapper {
    @Select("select * from user")
    List<User> getUsers();


    /*再使用注解的时候，如果方法存在多个参数*/
    /*所有的参数前面必须加上 @Param("id") 注解*/
    @Select("select * from user where id=#{id}")
    User getUserByID(@Param("id") int id2);


    @Insert("insert into user(id,name,pwd) values (#{id},#{name},#{pwd})")
    int addUser(User user);


    @Update("update user set name=#{name},pwd=#{pwd} where id=#{id}")
    int updateUser(User user);

    @Delete("delete from user where id=#{id}")
    int deleteUser(@Param("id") int id);
}
